<include file="./App/Tpl/Home/Default/Public/header.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="__JS__/qtip/css/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<literal>
<script>
$(document).ready(function(){
	
	
	$("#U_EMAIL").focus(function(){
		userTip1('U_EMAIL','邮箱是重要输入项,作为登录账号使用');
		
	});
	

	
	$("#P_BRAND").bind('change',function(){
		
		if($(this).val()==''){
			return false;
		}
		$("#P_CATEGORY").empty();
		$("#P_CATEGORY").append('<option value="">--产品类型--</option>');
		getProduct('P_BRAND',$(this).val(),'P_CATEGORY');
	});
	$("#P_CATEGORY").bind('change',function(){
		if($(this).val()==''){
			return false;
		}
		$('#P_MODEL').empty();
		$('#P_MODEL').append('<option value="">--产品型号--</option>');
		getProduct('P_BRAND|P_CATEGORY',$("#P_BRAND").val()+"|"+$(this).val(),'P_MODEL');
	});
	function getProduct(stName,st,fl){
		$.ajax({
			   type: "POST",
			   url: "?g=Home&m=Index&a=getProduct",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
					}
					$("#"+f).append(_html.join(''));
				 }
			     
			   }
		});
	}
	//得到地区
	$("#AR_L1").bind('change',function(){
		if($(this).val()==''){
			return false;
		}
		$("#AR_L2").empty();
		$("#AR_L2").append('<option value="">--市辖区--</option>');
		getArea('AR_L1',$(this).val(),'AR_L2');
	});
	$("#AR_L2").bind('change',function(){
		if($(this).val()==''){
			return false;
		}
		$('#AR_L3').empty();
		$('#AR_L3').append('<option value="">--区县--</option>');
		getArea('AR_L1|AR_L2',$("#AR_L1").val()+"|"+$(this).val(),'AR_L3');
	});
	$("#AR_L3").bind('change',function(){
		if($(this).val()==''){
			return false;
		}
		$('#AR_L4').empty();
		$('#AR_L4').append('<option value="">--乡镇--</option>');
		getAreaExtend($("#AR_L1").val()+"|"+$("#AR_L2").val()+"|"+$(this).val());
	});
	function getArea(stName,st,fl){
		$.ajax({
			   type: "POST",
			   url: "?g=Home&m=Index&a=getArea",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
					
					for (k in data){
						_html.push('<li><a href="javascript:;">'+data[k]+'</a></li>');
					}
					$("#"+f+"_1").append(_html.join(''));
				 }
			     
			   }
		});
	}
	$("#P_CHANNEL_ID").bind('change',function(){
		if($(this).val()>0){
			var txt=$(this).find("option:selected").text();  
			$("#P_CHANNEL").val(txt);
		}else{
			$("#P_CHANNEL").val('');
		}
		
	});
	//检测服务队
	$(".test").click(function(){
		var AR_L1=$("#AR_L1").val();
		var AR_L2=$("#AR_L2").val();
		var AR_L3=$("#AR_L3").val();
		var __data="a1="+encodeURI(AR_L1)+"&a2="+encodeURI(AR_L2)+"&a3="+encodeURI(AR_L3)+'&rd'+Math.random();
		
		$.ajax({
			   type: "POST",
			   url: "?g=Home&m=Index&a=checkArea",
			   data: __data,
			   dataType:'text',
			   success: function(msg){
					if(msg=='y'){
						$(".wrong").hide();
						$(".err").show();
						$(".yes").show();
					}else{
						$(".yes").hide();
						$(".err").show();
						$(".wrong").show();
					}
			     
			   }
		});
	});
	
	//使用列子在  http://craigsworks.com/projects/qtip2/demos/
	function userTip1(sob,ct){
		 // 阴影+圆角
	      $("#"+sob).qtip({
	        position: {
	          my: 'bottom left',
	          at: 'top center'
	        },
	        style: {
	          classes: 'ui-tooltip-blue ui-tooltip-shadow ui-tooltip-rounded'
	        },
	        show: {
				event: false, // Don't specify a show event...
				ready: true // ... but show the tooltip when ready
			},
	        content: ct
	      });
	}
	
	$("#go_submit").click(function(){
		if(getValCheck()){
			$('#orderForm').ajaxSubmit(options); 
		}
	});
	var options={
			 beforeSubmit:  showRequest,  
			 success:       showResponse  
	};
	function showRequest(formData, jqForm, options) {  
		return true;
	}
	
	function showResponse(responseText, statusText, xhr, $form)  { 
		//转到再次确认页面
		
		//需要后台验证邮箱是否唯一
		//alert(responseText);
		var islogin="{$islogin}";
		if(islogin && islogin=='y'){
			//登录后不判断
			window.location.href="?g=Home&m=Skin&a=confirm&sid="+responseText;
		}else{
			if(responseText=='M'){
				userTip('U_MOBILE','手机已存在');
				return false;
			}
			
			else if(responseText=='E'){
				userTip('U_EMAIL','邮箱已存在');
				return false;
			}
			else{
				window.location.href="?g=Home&m=Skin&a=confirm&sid="+responseText;
			}
		}
		
		
	} 
});
function setArea(stName,st,fl,v){
	$.ajax({
		   type: "POST",
		   url: "?g=Home&m=Index&a=getArea",
		   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
		   dataType:'json',
		   success: function(msg){
			 if(msg.sucess=='y'){
				var f=msg.fl;
				var data=msg.data;
				var _html=[];
				var k;
				for (k in data){
					var _sel='';
					if(v==data[k]){
						_sel="selected";
					}
					_html.push('<option value="'+data[k]+'"  '+_sel+'>'+data[k]+'</option>');
				}
				
				$("#"+f).append(_html.join(''));
			 }
		     
		   }
	});
}
function setAreaExtend(st,field){
	var url="st="+encodeURI(st)+'&rd='+Math.random()+"&isviewEmpty=y";
	$.ajax({
		   type: "POST",
		   url: "?g=Home&m=Index&a=getAreaExtend",
		   data: url,
		   dataType:'json',
		   success: function(msg){
			 if(msg.sucess=='y'){
				var data=msg.data;
				var _html=[];
				var k;
				for (k in data){
					var _sel='';
					if(field==data[k]){
						_sel="selected";
					}
					_html.push('<option value="'+data[k]+'" '+_sel+'>'+data[k]+'</option>');
				}
				$("#AR_L4").append(_html.join(''));
			 }
		   }
	});
}
function getAreaExtend(st){
	var url="st="+encodeURI(st)+'&rd='+Math.random();
	$.ajax({
		   type: "POST",
		   url: "?g=Home&m=Index&a=getAreaExtend",
		   data: url,
		   dataType:'json',
		   success: function(msg){
			 if(msg.sucess=='y'){
				var data=msg.data;
				var _html=[];
				var k;
				for (k in data){
					_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
				}
				$("#AR_L4").append(_html.join(''));
			 }
		   }
	});
}
function setProduct(stName,st,fl,v){
	$.ajax({
		   type: "POST",
		   url: "?g=Home&m=Index&a=getProduct",
		   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
		   dataType:'json',
		   success: function(msg){
			 if(msg.sucess=='y'){
				var f=msg.fl;
				var data=msg.data;
				var _html=[];
				var k;
				
				for (k in data){
					var _sel='';
					if(v==data[k]){
						_sel="selected";
					}
					_html.push('<option value="'+data[k]+'" '+_sel+'>'+data[k]+'</option>');
				}
				
				$("#"+f).append(_html.join(''));
			 }
		     
		   }
	});
}
function showLogin(){
	var url="?g=Home&m=Member&a=loginform";
	pDialog('',url,500,380);
}

function getValCheck(){
	if($("#O_REQ_TIME").val()==""){
		userTip('O_REQ_TIME','请选择期望上门时间');
		return false;
	}
	
	if($("#U_EMAIL").val()==""){
		userTip('U_EMAIL','请输入联系邮箱');
		return false;
	}else{
		var _re=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
		
		if(!_re.test($("#U_EMAIL").val())){
			userTip('U_EMAIL','联系邮箱格式错误');
			return false;
		}
	}
	var isLogin=$("#isLogin").val();
	if(isLogin=="y"){
		
	}else{
	if($("#U_PWD").val()==""){
		userTip('U_PWD','请输入查询密码');
		return false;
	}
	
	if($("#U_PWD1").val()==""){
		userTip('U_PWD1','请输入确认密码');
		return false;
	}
	
	if($("#U_PWD").val()!=$("#U_PWD1").val()){
		userTip('U_PWD1','查询与确认密码不符');
		return false;
	}
	}
	if($("#U_RNAME").val()==""){
		userTip('U_RNAME','请输入姓名');
		return false;
	}
	if($("#U_MOBILE").val()==""){
		userTip('U_MOBILE','请输入手机');
		return false;
	}
	else{
		/*var _re=/^\d{11}$/;
		alert(_re.test($("#U_MOBILE").val()));
		if(!_re.test($("#U_MOBILE").val())){
			userTip('U_MOBILE','手机格式错误');
			return false;
		}
		*/
		if($("#U_MOBILE").val().length<11){
			userTip('U_MOBILE','手机格式错误');
			return false;
		}
	}
	
	if($("#AR_L1").val()==''){
		userTip('AR_L1','请选择省市');
		return false;
	}
	if($("#AR_L2").val()==''){
		userTip('AR_L2','请选择市辖区');
		return false;
	}
	if($("#AR_L3").val()==''){
		userTip('AR_L3','请选择区县');
		return false;
	}
	
	if($("#O_ADDRESS").val()=='' || "填写详情地址"==$("#O_ADDRESS").val()){
		userTip('O_ADDRESS','请输入详细地址');
		return false;
	}
	if($("#P_BRAND").val()==''){
		userTip('P_BRAND','请选择品牌');
		return false;
	}
	if($("#P_CATEGORY").val()==''){
		userTip('P_CATEGORY','请选择产品类型');
		return false;
	}
	if($("#P_MODEL").val()==''){
		userTip('P_MODEL','请选择产品型号');
		return false;
	}
	
	
	if($("#P_BUY_TIME").val()==''){
		userTip('P_BUY_TIME','请选择购买时间');
		return false;
	}
	if($("#P_CHANNEL_ID").val()==''){
		userTip('P_CHANNEL_ID','请选择购买渠道');
		return false;
	}
	
	
	
	
	return true;
}


//使用列子在  http://craigsworks.com/projects/qtip2/demos/
function userTip(sob,ct){
	 // 阴影+圆角
      $("#"+sob).qtip({
        position: {
          my: 'bottom left',
          at: 'top center'
        },
        style: {
          classes: 'ui-tooltip-red ui-tooltip-shadow ui-tooltip-rounded'
        },
        show: {
			event: false, // Don't specify a show event...
			ready: true // ... but show the tooltip when ready
		},
        content: ct
      });
}

function quit(){
	$.ajax({
		   type: "POST",
		   url: "?g=Home&m=Index&a=logout",
		   data: '',
		   success: function(msg){
			   var type='1';
				var info="退出成功！";
				var url="?g=Home&m=Skin&a=login&ly=7";
				if(msg=="srv"){
					url="?g=Home&m=Skin&a=login&ly=8";
				}
				
			   window.location.href="?g=Home&m=Skin&a=message&type="+type+"&info="+encodeURI(info)+"&url="+encodeURIComponent(url);
				
		   }
	});
	
}
</script>
</literal>
<style>
.myselect{
	width:110px;
	height:20px;
}
.myselect1{
	width:50px;
	height:20px;
}

</style>
<div class="main">
	<div class="book">
    	<h1>佳空间蓝色安装队服务预约单</h1>
    	<form action="?g=Home&m=Index&a=confirmOrder" method="post" id="orderForm">
        <div class="book_form">
            <fieldset>
                <legend>服务预约单</legend>
                <div class="book_one">
                	<h3>服务性质</h3>
                    <div id="radiolist">
                         <input name="data[O_TYPE]" type="radio" value="1" <if condition="$seData.O_TYPE eq 1">checked <elseif condition="$seData.O_TYPE neq 2" />checked</if> /><label>报装</label>
                          <input name="data[O_TYPE]" type="radio" value="2" <if condition="$seData.O_TYPE eq 2">checked</if>/><label>报修</label>
                    </div>
                    <div class="book_time">预约服务时间：
                    <input readonly onclick="WdatePicker({el:'O_REQ_TIME',dateFmt:'yyyy-MM-dd HH:mm'})"  id="O_REQ_TIME" name="data[O_REQ_TIME]" value="{$seData.O_REQ_TIME|default=''}" readonly type="text" class="book_ipt ipt_107" />
                    </div>
                </div>
                <div class="book_two">
                	<h3>顾客信息</h3>
                    <div class="book_input please">
                    <if condition="$userName eq '#*#'">
                    如果您已经是佳空间的注册用户，请 <a href="?g=Home&m=Skin&a=login">直接登录</a>
                    <else />
                    欢迎您：{$userName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" onclick="quit();return false;" ><font color="#8AB729">[退出]</font></a>
                    <a href="?g=Home&m=Skin&a=changePwd"><font color="#8AB729">[修改密码]</font></a>
                    </if>
                    </div>
                    <div class="book_input">
                        <span class="red">*</span>注册邮箱：<input id="U_EMAIL"  name="data[U_EMAIL]" value="{$seData.U_EMAIL|default=''}" type="text" class="book_ipt ipt_213" />　
                       <if condition="$islogin eq 'y'">
                       <else />
                        <span class="red">*</span>密码：<input id="U_PWD"  name="data[U_PWD]" value="{$seData.U_PWD|default=''}"  type="password" class="book_ipt ipt_107" />　
                        <span class="red">*</span>确认密码：<input id="U_PWD1" name="data[U_PWD1]" value="{$seData.U_PWD1|default=''}" type="password" class="book_ipt ipt_107" />
                        </if>
                    </div>
                    <div class="book_input">
                        <span class="red">*</span>姓名：<input id="U_RNAME" name="data[U_RNAME]" value="{$seData.U_RNAME|default=''}" type="text" class="book_ipt ipt_144" />　
                        <span class="red">*</span>手机：<input id="U_MOBILE" onkeyup="this.value=this.value.replace(/\D/g,'');" name="data[U_MOBILE]" value="{$seData.U_MOBILE|default=''}" type="text" class="book_ipt ipt_144" />　
                        固定电话：<input id="U_PHONE" name="data[U_PHONE]" value="{$seData.U_PHONE|default=''}" type="text" class="book_ipt ipt_171" />
                    </div>
                    <div class="book_input select">
                    	 <table width="" border="0" cellpacing="0" cellpadding="0">
							<tr>
								<td ><span class="red">*</span>地址：</span></td>
								<td>
									 <select class="myselect"  id="AR_L1" name="data[AR_L1]">
									<option value="">--省市--</option>
									<volist name="AR_L1" id="vo">
									<option value="{$vo}" <if condition="$seData.AR_L1 eq $vo">selected</if>>{$vo}</option>
									</volist>
								</select>
								</td>
								<td >
									 <select class="myselect"   id="AR_L2" name="data[AR_L2]">
									<option value="">--市辖区--</option>
								</select>
								</td>
								<td>
									 <select class="myselect"  id="AR_L3" name="data[AR_L3]">
										<option value="">--区县--</option>
									</select>
								</td>
								<td>
                                <select class="select2"  id="AR_L4" name="data[AR_L4]">
									<option value="">--乡镇--</option>
								</select>
                            	</td>
								
							</tr>
						</table>
                        
                    </div>
                    <div class="book_input">
                        <span class="red">*</span>详细地址：<input id="O_ADDRESS" name="data[O_ADDRESS]" value="{$seData.O_ADDRESS|default=''}"  type="text" class="book_ipt ipt_340" />　
                    </div>
                </div>
                <div class="book_three">
                	<h3>商品信息</h3>
                    <div class="book_input select">
                         <table width="" border="0" cellpacing="0" cellpadding="0">
							<tr>
								<td ><span class="red">*</span>选择产品：</span></td>
								<td>
									<select class="myselect"   id="P_BRAND" name="data[P_BRAND]">
										<option value="">--品牌--</option>
										<volist name="BRAND" id="vo">
										<option value="{$vo}" <if condition="$seData.P_BRAND eq $vo">selected</if>>{$vo}</option>
										</volist>
									</select>
								</td>
								<td >
									<select class="myselect"   id="P_CATEGORY" name="data[P_CATEGORY]">
										<option value="">--产品类型--</option>
									</select>
								</td>
								<td>
									<select class="myselect" id="P_MODEL" name="data[P_MODEL]">
										<option value="">--产品型号--</option>
									</select>
								</td>
								
								<td>数量:
									<select  id="P_COUNT" name="data[P_COUNT]" class="myselect1">
									    <for start="1" end="21">
										<option value="{$i}" <if condition="$seData.P_COUNT eq $i">selected</if>>{$i}</option>
										</for>
									</select>
								</td>
							</tr>
						</table>
                    </div>
                    <div class="book_input select">
                        <span class="red">*</span><span>购买时间：</span>
                    	<div id="select6" class="select110 dropdown">
                        	<input class="book_ipt ipt_122"  onclick="WdatePicker({el:'P_BUY_TIME'})"  type="text" id="P_BUY_TIME" name="data[P_BUY_TIME]" value="{$seData.P_BUY_TIME|default=''}" readonly>
                        </div>
                        
                    </div>
                    <div class="book_input select">
                       	<table  border="0" cellpacing="0" cellpadding="0">
                       		<tr>
                       			<td>
                       				<span class="red">*</span>购买渠道：
                       			</td>
                       			<td>
                       				 <select class="select"  id="P_CHANNEL_ID" name="data[P_CHANNEL_ID]">
										<option value="">--选择渠道--</option>
										<volist name="channel" id="vo">
										<assign name="channelSelect" value="$vo.id" />
										<option value="{$vo.id}" <if condition="$seData.P_CHANNEL_ID eq $channelSelect">selected</if>>{$vo.name}</option>
										</volist>
									</select>
                       			</td>
                       			<td>
                       				<input type="text"   class="book_ipt ipt_122"id="P_CHANNEL" name="data[P_CHANNEL]" value="{$seData.P_CHANNEL|default=''}" >
                       			</td>
                       			<td>
                       			订单号：<input id="SO_ID" name="data[SO_ID]"  type="text" class="book_ipt ipt_122" value="{$seData.SO_ID|default=''}" />　
                       			</td>
                       		</tr>
                       	</table>　
                    </div>
                </div>
                <div class="book_four">
                	<h3>添加备注</h3>
                    <textarea id="O_MEMO" name="data[O_MEMO]" cols="" rows="" class="book_ipt book_textarea">{$seData.O_MEMO|default=''}</textarea>
                </div>
                <div   id="go_submit"  class="book_btn">
                <input type="hidden" id="isLogin" value="{$islogin}">
                <input  type="button" value="提交服务单"/>
                
                </div>
                <div style="display:none">
				<input type="submit" id="sumit" name="sumit"   >
				<input type="text" name="data[orderNO]" id="orderNO" value="{$orderNO}">
                </div>
                <div class="man"></div>
                <div class="auto_time">提交时间：2013/06/10(自动)</div>
            </fieldset>
        </div>
        </form>
    </div>
    <div class="ins">
    	<p>*为了为您提供最专业快捷的服务，请您尽可能将表格所需信息填写详尽。</p>
    	<p>*如果您所在地区不在我们的服务范畴之内，我们将无法为你提供上门服务，请您理解。</p>
    	<p>*预约单提交成功后，您的手机和邮箱都将收到我们的短信提醒，告知将为你服务的安装队的具体联络方式，您也可以据此主动与服务队取得联络，确认服务内容和上门时间。</p>
    	<p>*请牢记您在提交此预约单时填写的密码，可以使用注册邮箱（或手机号码）和这个密码作为用户登录，查询服务单的进度。</p>
    </div>
</div>
<if condition="$seData.AR_L1 neq ''">
	
	<script>
		$("#AR_L2").empty();
		$("#AR_L2").append('<option value="">--市辖区--</option>');
		setArea('AR_L1',$("#AR_L1").val(),'AR_L2','{$seData.AR_L2}');
		
		$('#AR_L3').empty();
		$('#AR_L3').append('<option value="">--区县--</option>');
		setArea('AR_L1|AR_L2',"{$seData.AR_L1}|{$seData.AR_L2}",'AR_L3','{$seData.AR_L3}');
		$('#AR_L4').empty();
		$('#AR_L4').append('<option value="">--乡镇--</option>');
		setAreaExtend("{$seData.AR_L1}|{$seData.AR_L2}|{$seData.AR_L3}","{$seData.VT_NAME}");
	</script>
	
</if>
<if condition="$seData.P_BRAND neq ''">

	<script>
		$("#P_CATEGORY").empty();
		$("#P_CATEGORY").append('<option value="">--产品类型--</option>');
		setProduct('P_BRAND','{$seData.P_BRAND}','P_CATEGORY','{$seData.P_CATEGORY}');
		
		$('#P_MODEL').empty();
		$('#P_MODEL').append('<option value="">--产品型号--</option>');
		setProduct('P_BRAND|P_CATEGORY',"{$seData.P_BRAND}|{$seData.P_CATEGORY}",'P_MODEL','{$seData.P_MODEL}');
	</script>

</if>
<include file="./App/Tpl/Home/Default/shop.html" />
<include file="./App/Tpl/Home/Default/partners.html" />
<include file="./App/Tpl/Home/Default/Public/footer.html" />	